import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InformationVO, InformationForm, InformationQuery } from '@/api/business/information/types';

/**
 * 查询信息列表
 * @param query
 * @returns {*}
 */

export const listInformation = (query?: InformationQuery): AxiosPromise<InformationVO[]> => {
  return request({
    url: '/business/information/listHt',
    method: 'get',
    params: query
  });
};

/**
 * 查询信息详细
 * @param id
 */
export const getInformation = (id: string | number): AxiosPromise<InformationVO> => {
  return request({
    url: '/business/information/info/' + id,
    method: 'get'
  });
};

/**
 * 新增信息
 * @param data
 */
export const addInformation = (data: InformationForm) => {
  return request({
    url: '/business/information',
    method: 'post',
    data: data
  });
};

/**
 * 修改信息
 * @param data
 */
export const updateInformation = (data: InformationForm) => {
  return request({
    url: '/business/information',
    method: 'put',
    data: data
  });
};

/**
 * 删除信息
 * @param id
 */
export const delInformation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/information/' + id,
    method: 'delete'
  });
};
